import {useRoutes,Navigate} from 'react-router-dom'
import Home from '../views/Home'
import About from '../views/About'
import Films from '../views/Films'
import Hot from '../views/Hot'
import ErrorPage from '../views/ErrorPage'
import Detail from '../views/Detail'
import City from '../views/City'
const RouterView = () => {
  const routes = useRoutes([
    {
      path: "/",
      element: <Home/>
    }, {
      path: "/about",
      element: <About/>,
      children:[
        {
          // 路由重定向
          path:"/about",
          element:<Navigate to="/about/films"/>
        },
        {
          path:"films",
          element:<Films/>
        },{
          path:"hot",
          element:<Hot/>
        }
      ]
    },{
      path:"*",
      element:<ErrorPage/>
    },{
      path:"detail",
      element:<Detail/>
    },
    {
      path:"city",
      element:<City/>
    }
  ])
  return routes;
}
export default RouterView;